********************************
***Control Groups vs. No Audio***
********************************

clear all

********************
*Set Person Working*
*Change this to your name!!!!!
********************
*global carolina 0
*global emily 1

global emily 1
global carolina 0

*********************
*Load Files*
*********************

*Carolina's Computer*
if $carolina ==1  {
cap cd "~\Dropbox\Carolina-Emily-Project\Data\Study"
global out "..\..\Results\"
}


if $emily ==1  {
*Emily's Computer*
cap cd "~/Dropbox/SourceContent/Data/Study"
global out "../../Results/"
} 

*Log Probability Version*
	
/*Robustness Scatters*
1. Remove One Question at a time
2. Single Question Results
*/	
	
*********************************
***Create Variables and Format***
*********************************



global lasso0 hispanic age55_64 candidate16_hillary candidate16_other ///
	immlevel_decrease gun_lessstrict abortion_illegal tax_toohigh health_notgvt ///
	occ_twitter occ_buzzfeed trumpfan lebronfan taylorfan bgatesfan ///
	obamafan obama_neutral topissue_health 
	
global lasso1 black hispanic age35_44 age45_54 hsdegree ///
	candidate16_hillary immlevel_decrease immlevel_same ///
	gun_same gun_lessstrict abortion_partlegal abortion_illegal tax_toohigh ///
	health_neutral health_notgvt i.freq_nytimes ///
	daily_tv occ_tv daily_newspaper i.freq_fox week_breitbart ///
	daily_breitbart occ_buzzfeed ///
	lebron_neutral obamafan trump_neutral trumpfan west topissue_tax 

global message1 "Anti"
global message2 "Anti"
global message3 "Pro"
global message4 "Pro"

global source1 "Trump"
global source2 "Obama"
global source3 "Trump"
global source4 "Obama" 

global party0 "Republicans"
global party1 "Democrats"
global var0 "ln(Probability Anti-Immigrant + 1)"
global var1 "ln(Probability Pro-Immigrant + 1)"
global dir0 "anti"
global dir1 "pro"

global color1 "blue"
global color0 "red"

global label1a0 "{bf:Anti}	"
global label2a0 "{bf:Anti}	"
global label3a0 "{bf:Pro}	"
global label4a0 "{bf:Pro}	"
global label1b0 "{bf:Trump}	"
global label2b0 "{bf:Obama}	"
global label3b0 "{bf:Trump}	"
global label4b0 "{bf:Obama}	"

global width0 "3"
global width1 "2.25"

foreach x in a b {
foreach y in 1 2 3 4 {
	global label`y'`x'1 ""
}
}		

**************************************************
*CREATE SINGLE QUESTIONS AND LEAVE OUT MEANS*
**************************************************

use 3_clean_data, replace

gen group1=treatment==5 | treatment==7 | treatment==0
gen group2=treatment==6 | treatment==8 | treatment==0
gen group3=treatment==1 | treatment==3 | treatment==0
gen group4=treatment==2 | treatment==4 | treatment==0

gen president=treatment==1 | treatment==2 | treatment==5 | treatment==6
gen actor=treatment==3 | treatment==4 | treatment==7 | treatment==8
gen turkey= treatment==9 | treatment==10
gen priming=turkey==1 | president==1
gen message=actor==1 | president==1

*Create Single Questions and Leave Out Means*
*Single Questions*

foreach x in pro anti {

gen q1_`x'=post_borderwall_`x'
gen q2_`x'=post_borderpatrol_`x'
gen q3_`x'=post_checkworkerimmstatus_`x'
gen q4_`x'=post_deportall_`x'
gen q5_`x'=post_deportcrimerecord_`x'
gen q6_`x'=post_pathtocitizen_`x'
gen q7_`x'=post_dreamerpathtocitizen_`x'
gen q8_`x'=post_contribdreamer_`x'
gen q9_`x'=post_contribspanish_`x'
gen q10_`x'=post_contribenglish_`x'
gen q11_`x'=post_contriblegal_`x'
gen q12_`x'=post_contribillegal_`x'
gen q13_`x'=post_immlevel_`x'
gen q14_`x'=post_economicimpact_`x'
gen q15_`x'=post_crimeshare_`x'
gen q16_`x'=post_overall_`x'

}


****************************
*Specific Questions - Parsimonious Split*
****************************
*Republicans*
/*Questions of Interest*
16. Overall View
7. Dreamer Path
6. Path
4. Deport All
3. Worker Status
2. Border Patrol
Other: 1,5,8,9,10,11,12,13,14,15
*/
*Democrats*
/*Questions of Interest*
14. Economic Impact
12. Illegal Contribution
5. Deport Crime
4. Deport All
3. Worker Status
2. Border Patrol
Other: 1,6,7,8,9,10,11,13,15,16
*/
foreach x in pro anti {

	egen other0_`x'=rowmean(q1_`x' q5_`x' q8_`x' q9_`x' q10_`x' q11_`x' q12_`x' q13_`x' q14_`x'  q15_`x')
	replace other0_`x'=ln(other0_`x'+1)
	
	egen other1_`x'=rowmean(q1_`x' q6_`x' q7_`x' q8_`x' q9_`x' q10_`x' q11_`x' q13_`x'  q15_`x' q16_`x')
	replace other1_`x'=ln(other1_`x'+1)

	}

foreach x in pro anti {
foreach z of numlist 1/16 {

	gen lq`z'_`x'=ln((prob_index_`x'-q`z'_`x'/16)*16/15+1)

	replace q`z'_`x'=ln(q`z'_`x'+1)
	
	}
}

save 11_byquestion_data, replace

**************************************************
*CREATE PLOTS OF RESULTS*
**************************************************

***************************************************
*1. Leave Out Question and By Question Cloud Plots*
***************************************************

use 11_byquestion_data, replace

foreach m in "m" "ms" {
foreach p in 0 1 {
	gen blq`m'`p'=.
	gen bq`m'`p'=.
	gen b`m'`p'=.
	gen u`m'`p'=.
	gen l`m'`p'=.
}
}

gen x=1 if _n<=16
replace x=2 if _n>16 & _n<=32
replace x=3 if _n>32 & _n<=48
replace x=4 if _n>48 & _n<=64

gen n=_n
gen n1=_n

foreach p in 0 1 {

local n=0
local n1=0

foreach y in 4 3 2 1 {

	local n1=`n1'+1

	reg ln1_prob_index_${dir`p'} message president ${lasso`p'} ///
		if (group`y'==1) & recruit==`p' , robust
		replace bm`p' = _b[message] if n1==`n1'
		replace um`p' = _b[message]+1.96*_se[message] if n1==`n1'
		replace lm`p' = _b[message]-1.96*_se[message] if n1==`n1'
		replace bms`p' = _b[president] if n1==`n1'
		replace ums`p' = _b[president]+1.96*_se[president] if n1==`n1'
		replace lms`p' = _b[president]-1.96*_se[president] if n1==`n1'

	foreach z of numlist 1/16 { 
	
	local n=`n'+1

	reg q`z'_${dir`p'} message president ${lasso`p'} ///
		if (group`y'==1) & recruit==`p' , robust
		replace bqm`p' = _b[message] if n==`n'
		replace bqms`p' = _b[president] if n==`n'
	reg lq`z'_${dir`p'} message president ${lasso`p'} ///
		if (group`y'==1) & recruit==`p' , robust
		replace blqm`p' = _b[message] if n==`n'
		replace blqms`p' = _b[president] if n==`n'
	
	}
	
	}
	
foreach m in "m" "ms" {
	
# delimit ;
twoway	
	(scatter x bq`m'`p'  if x==4, mcolor(gray) jitter(16) msize(small) msymbol(circle_hollow))
	(scatter x bq`m'`p'  if x==3, mcolor(gray) jitter(16) msize(small) msymbol(circle_hollow))	
	(scatter x bq`m'`p'  if x==2, mcolor(gray) jitter(16) msize(small) msymbol(circle_hollow))	
	(scatter x bq`m'`p'  if x==1, mcolor(gray) jitter(16) msize(small) msymbol(circle_hollow))	
	(scatter n1 b`m'`p'  if n1<5, mcolor(black) msym(diamond) )	
	(rcap u`m'`p' l`m'`p' n1  if n1<5, horizontal lcolor(black) lwidth(medthick))	
	, 
	xline(0, lcolor(black)) 
	ylabel(
	4.4 	" "
	4	`" "${label1a`p'}" "${label1b`p'}" "'
	3	`" "${label2a`p'}" "${label2b`p'}" "'
	2	`" "${label3a`p'}" "${label3b`p'}" "'
	1	`" "${label4a`p'}" "${label4b`p'}" "'
	0.6	" "
	, angle(0) labsize(small)) 
	xtitle(" " "{bf:${party`p'}}" "{it:${var`p'}}" " ")
	ytitle(" ")
	ylab(, nogrid)
	xlab(-0.1(0.02)0.08)
	graphregion(color(white)) 
	legend(order(5 "Index"  1 "Individual Questions" ) rows(1))
	ylabel(, tlength(0)) saving("$out/q`m'`p'.gph", replace)
	;
# delimit cr
	
# delimit ;
twoway	
	(scatter x blq`m'`p'  if x==4, mcolor(gray) jitter(16) msize(small) msymbol(circle_hollow))
	(scatter x blq`m'`p'  if x==3, mcolor(gray) jitter(16) msize(small) msymbol(circle_hollow))	
	(scatter x blq`m'`p'  if x==2, mcolor(gray) jitter(16) msize(small) msymbol(circle_hollow))	
	(scatter x blq`m'`p'  if x==1, mcolor(gray) jitter(16) msize(small) msymbol(circle_hollow))	
	(scatter n1 b`m'`p'  if n1<5, mcolor(black) msym(diamond) )	
	(rcap u`m'`p' l`m'`p' n1  if n1<5, horizontal lcolor(black) lwidth(medthick))	
	, 
	xline(0, lcolor(black)) 
	ylabel(
	4.4 	" "
	4	`" "${label1a`p'}" "${label1b`p'}" "'
	3	`" "${label2a`p'}" "${label2b`p'}" "'
	2	`" "${label3a`p'}" "${label3b`p'}" "'
	1	`" "${label4a`p'}" "${label4b`p'}" "'
	0.6	" "
	, angle(0) labsize(small)) 
	xtitle(" " "{bf:${party`p'}}" "{it:${var`p'}}" " ")
	ytitle(" ")
	ylab(, nogrid)
	graphregion(color(white)) 
	legend(order(5 "Index"  1 "Leave Out Individual Questions" ) rows(1))
	ylabel(, tlength(0)) saving("$out/lq`m'`p'.gph", replace)
	;
# delimit cr
	
}
}

# delimit ;
grc1leg "$out/lqm0.gph" "$out/lqm1.gph", 
	ycommon xcommon legendfrom("$out/lqm0.gph")
	graphregion(color(white)) 
	imargin(-5.5 -3 -6 -12) scale(1.1) 
;
# delimit cr
graph export "$out/B8_LeaveOutQuestion_AnonymousMessage.pdf", replace	

# delimit ;
grc1leg "$out/lqms0.gph" "$out/lqms1.gph", 
	ycommon xcommon legendfrom("$out/lqms1.gph")
	graphregion(color(white))  
	imargin(-5.5 -3 -6 -12) scale(1.1) 
;
# delimit cr
graph export "$out/B8_LeaveOutQuestion_Persuasion.pdf", replace	


# delimit ;
grc1leg "$out/qm0.gph" "$out/qm1.gph", 
	ycommon xcommon legendfrom("$out/qm0.gph")
	graphregion(color(white)) 
	imargin(-5.5 -4 -6 -12) scale(1.1) 
;
# delimit cr
graph export "$out/B9_ByQuestion_AnonymousMessage.pdf", replace	

# delimit ;
grc1leg "$out/qms0.gph" "$out/qms1.gph", 
	ycommon xcommon legendfrom("$out/qms1.gph")
	graphregion(color(white))  
	imargin(-5.5 -4 -6 -12) scale(1.1) 
;
# delimit cr
graph export "$out/B9_ByQuestion_Persuasion.pdf", replace	


****************************************
*2. Individual Question Plots*
****************************************

use 11_byquestion_data, replace

foreach m in "m" "ms" {
foreach p in 0 1 {
	gen b`m'`p'=.
	gen u`m'`p'=.
	gen l`m'`p'=.
}
}

gen n=_n

foreach p in 0 1 {

local n=0
	
foreach y in 4 3 2 1 {

foreach z of numlist 1/16 { 
	
	local n=`n'+1
 
	reg q`z'_${dir`p'} message president ${lasso`p'} ///
		if (group`y'==1) & recruit==`p' , robust 

		replace bm`p' = _b[message] if n==`n'
		replace um`p' = _b[message]+1.96*_se[message] if n==`n'
		replace lm`p' = _b[message]-1.96*_se[message] if n==`n'
		replace bms`p' = _b[president] if n==`n'
		replace ums`p' = _b[president]+1.96*_se[president] if n==`n'
		replace lms`p' = _b[president]-1.96*_se[president] if n==`n'

	}
	
	local n=`n'+1
	
	}


foreach m in "m" "ms" {

# delimit ;
twoway	
	(rcap l`m'`p' u`m'`p' n if n==16 | n==33 | n==50 | n==67 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==16 | n==33 | n==50 | n==67 , mcolor(black) msymbol(circle))	
	(rcap l`m'`p' u`m'`p' n if n==15 | n==32 | n==49 | n==66 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==15 | n==32 | n==49 | n==66 , mcolor(black) msymbol(circle_hollow))	
	(rcap l`m'`p' u`m'`p' n if n==14 | n==31 | n==48 | n==65 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==14 | n==31 | n==48 | n==65 , mcolor(black) msymbol(circle))	
	(rcap l`m'`p' u`m'`p' n if n==13 | n==30 | n==47 | n==64 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==13 | n==30 | n==47 | n==64 , mcolor(black) msymbol(circle_hollow))	
	(rcap l`m'`p' u`m'`p' n if n==12 | n==29 | n==46 | n==63 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==12 | n==29 | n==46 | n==63 , mcolor(black) msymbol(circle))	
	(rcap l`m'`p' u`m'`p' n if n==11 | n==28 | n==45 | n==62 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==11 | n==28 | n==45 | n==62 , mcolor(black) msymbol(circle_hollow))	
	(rcap l`m'`p' u`m'`p' n if n==10 | n==27 | n==44 | n==61 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==10 | n==27 | n==44 | n==61 , mcolor(black) msymbol(circle))	
	(rcap l`m'`p' u`m'`p' n if n==9 | n==26 | n==43 | n==60 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==9 | n==26 | n==43 | n==60 , mcolor(black) msymbol(circle_hollow))	
	(rcap l`m'`p' u`m'`p' n if n==8 | n==25 | n==42 | n==59 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==8 | n==25 | n==42 | n==59 , mcolor(black) msymbol(circle))	
	(rcap l`m'`p' u`m'`p' n if n==7 | n==24 | n==41 | n==58 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==7 | n==24 | n==41 | n==58 , mcolor(black) msymbol(circle_hollow))	
	(rcap l`m'`p' u`m'`p' n if n==6 | n==23 | n==40 | n==57 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==6 | n==23 | n==40 | n==57 , mcolor(black) msymbol(circle))	
	(rcap l`m'`p' u`m'`p' n if n==5 | n==22 | n==39 | n==56 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==5 | n==22 | n==39 | n==56 , mcolor(black) msymbol(circle_hollow))	
	(rcap l`m'`p' u`m'`p' n if n==4 | n==21 | n==38 | n==55 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==4 | n==21 | n==38 | n==55 , mcolor(black) msymbol(circle))	
	(rcap l`m'`p' u`m'`p' n if n==3 | n==20 | n==37 | n==54 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==3 | n==20 | n==37 | n==54 , mcolor(black) msymbol(circle_hollow))	
	(rcap l`m'`p' u`m'`p' n if n==2 | n==19 | n==36 | n==53 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==2 | n==19 | n==36 | n==53 , mcolor(black) msymbol(circle))	
	(rcap l`m'`p' u`m'`p' n if n==1 | n==18 | n==35 | n==52 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  if n==1 | n==18 | n==35 | n==52 , mcolor(black) msymbol(circle_hollow))	
	, 
	xline(0, lcolor(black)) 
	ylabel(
	67	`" "${label1a`p'}		{it:Overall View}" "'
	66	`" "${label1b`p'}		{it:Crime Share}" "'
	65	`" "{it:Economic Impact}" "'
	64	`" "{it:Immigration Level}" "'
	63	`" "{it:Illegal Contribution}" "'
	62	`" "{it:Legal Contribution}" "'
	61	`" "{it:English Contribution}" "'
	60	`" "{it:Spanish Contribution}" "'
	59	`" "{it:Dreamer Contribution}" "'
	58	`" "{it:Dreamer Path Citizen}" "'
	57	`" "{it:Path Citizen}" "'
	56	`" "{it:Deport Crime}" "'
	55	`" "{it:Deport All}" "'
	54	`" "{it:Worker Status}" "'
	53	`" "{it:Border Patrol}" "'
	52	`" "{it:Border Wall}" "'
	51	" "
	50	`" "${label2a`p'}		{it:Overall View}" "'
	49	`" "${label2b`p'}		{it:Crime Share}" "'
	48	`" "{it:Economic Impact}" "'
	47	`" "{it:Immigration Level}" "'
	46	`" "{it:Illegal Contribution}" "'
	45	`" "{it:Legal Contribution}" "'
	44	`" "{it:English Contribution}" "'
	43	`" "{it:Spanish Contribution}" "'
	42	`" "{it:Dreamer Contribution}" "'
	41	`" "{it:Dreamer Path Citizen}" "'
	40	`" "{it:Path Citizen}" "'
	39	`" "{it:Deport Crime}" "'
	38	`" "{it:Deport All}" "'
	37	`" "{it:Worker Status}" "'
	36	`" "{it:Border Patrol}" "'
	35	`" "{it:Border Wall}" "'
	34	" "
	33	`" "${label3a`p'}		{it:Overall View}" "'
	32	`" "${label3b`p'}		{it:Crime Share}" "'
	31	`" "{it:Economic Impact}" "'
	30	`" "{it:Immigration Level}" "'
	29	`" "{it:Illegal Contribution}" "'
	28	`" "{it:Legal Contribution}" "'
	27	`" "{it:English Contribution}" "'
	26	`" "{it:Spanish Contribution}" "'
	25	`" "{it:Dreamer Contribution}" "'
	24	`" "{it:Dreamer Path Citizen}" "'
	23	`" "{it:Path Citizen}" "'
	22	`" "{it:Deport Crime}" "'
	21	`" "{it:Deport All}" "'
	20	`" "{it:Worker Status}" "'
	19	`" "{it:Border Patrol}" "'
	18	`" "{it:Border Wall}" "'
	17	" "
	16	`" "${label4a`p'}		{it:Overall View}" "'
	15	`" "${label4b`p'}		{it:Crime Share}" "'
	14	`" "{it:Economic Impact}" "'
	13	`" "{it:Immigration Level}" "'
	12	`" "{it:Illegal Contribution}" "'
	11	`" "{it:Legal Contribution}" "'
	10	`" "{it:English Contribution}" "'
	9	`" "{it:Spanish Contribution}" "'
	8	`" "{it:Dreamer Contribution}" "'
	7	`" "{it:Dreamer Path Citizen}" "'
	6	`" "{it:Path Citizen}" "'
	5	`" "{it:Deport Crime}" "'
	4	`" "{it:Deport All}" "'
	3	`" "{it:Worker Status}" "'
	2	`" "{it:Border Patrol}" "'
	1	`" "{it:Border Wall}" "'
	, angle(0) labsize(small)) 
	xtitle(" " "{bf:${party`p'}}" "{it:${var`p'}}" " ")
	ytitle(" ")
	xlab(-0.08(0.04)0.08)
	ylabel(, tlength(0) nogrid) saving("$out/q`m'`p'.gph", replace)
	graphregion(color(white)) 
	legend(off)
	;
	# delimit cr
	}
}


# delimit ;
graph combine "$out/qm0.gph" "$out/qm1.gph", 
	ycommon xcommon 
	graphregion(color(white)) 
	imargin(-8 0 -8 -42) scale(0.69) ysize(6)
;
# delimit cr
graph export "$out/B10_ByQuestionAll_AnonymousMessage.pdf", replace	

# delimit ;
graph combine "$out/qms0.gph" "$out/qms1.gph", 
	ycommon xcommon 
	graphregion(color(white))  
	imargin(-8 0 -8 -42) scale(0.69) ysize(6)
;
# delimit cr
graph export "$out/B11_ByQuestionAll_Persuasion.pdf", replace	


**************************************************
*11D. Policies vs. Beliefs Sub-Indices*
**************************************************

use 3_clean_data, replace

gen group1=treatment==5 | treatment==7 | treatment==0
gen group2=treatment==6 | treatment==8 | treatment==0
gen group3=treatment==1 | treatment==3 | treatment==0
gen group4=treatment==2 | treatment==4 | treatment==0

gen president=treatment==1 | treatment==2 | treatment==5 | treatment==6
gen actor=treatment==3 | treatment==4 | treatment==7 | treatment==8
gen turkey= treatment==9 | treatment==10
gen priming=turkey==1 | president==1
gen message=actor==1 | president==1

*1. Base
global spec1covar0 		"$lasso0"
global spec1covar1 		"$lasso1"
global spec1restrict	""
global spec1out			"ln1_prob_index_"

*2. Policies
global spec2covar0 		"$lasso0"
global spec2covar1 		"$lasso1"
global spec2restrict	""
global spec2out			"ln1_prob_policy_"

*3. Beliefs
global spec3covar0 		"$lasso0"
global spec3covar1 		"$lasso1"
global spec3restrict	""
global spec3out			"ln1_prob_belief_"

preserve

foreach p in 0 1 {
	gen bm`p'=.
	gen um`p'=.
	gen lm`p'=.
	gen bms`p'=.
	gen ums`p'=.
	gen lms`p'=.
}

gen n=_n

foreach p in 0 1 {

local n=0
	
foreach y in 4 3 2 1 {

foreach s in 3 2 1 {
	
	local n=`n'+1
 
	*Regression for Coefficients*
	reg ${spec`s'out}${dir`p'} message president ${spec`s'covar`p'} ///
		if (group`y'==1) & recruit==`p' ${spec`s'restrict}, robust
	
	*Anonymous Message - Beta_m*
	replace bm`p' = _b[message] if n==`n'
	replace um`p' = _b[message]+1.96*_se[message] if n==`n'
	replace lm`p' = _b[message]-1.96*_se[message] if n==`n'

	*Persuasion - Beta_ms *	
	replace bms`p' = _b[president] if n==`n'
	replace ums`p' = _b[president]+1.96*_se[president] if n==`n'
	replace lms`p' = _b[president]-1.96*_se[president] if n==`n'
	
	*Anonymous Message - P(Dist)*
	reg ${spec`s'out}${dir`p'} ${spec`s'covar`p'} ///
		if (group`y'==1 & president==0) & recruit==`p' ${spec`s'restrict}, robust
	predict res, res
	gen g=0 if actor==0 & e(sample)==1
	replace g=1 if actor==1 & e(sample)==1
	ksmirnov res if e(sample), by(g)
	local dm`n'`p'=round(r(p)*10000)/10000
	local dm`n'`p': di %6.3f `dm`n'`p''
	drop g res
	
	*Persuasion - P(Dist)*
	reg ${spec`s'out}${dir`p'} ${spec`s'covar`p'} ///
		if (group`y'==1 & treat!=0) & recruit==`p' ${spec`s'restrict}, robust
	predict res, res
	gen g=0 if president==0 & e(sample)==1
	replace g=1 if president==1 & e(sample)==1
	ksmirnov res if e(sample), by(g)
	local dms`n'`p'=round(r(p)*10000)/10000
	local dms`n'`p': di %6.3f `dms`n'`p''
	drop g res

	}
	
	local n=`n'+1
	
}

foreach m in "m" "ms" {

# delimit ;
twoway	
	(rcap l`m'`p' u`m'`p'  n 	if n==3 | n==7 | n==11 | n==15 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  		if n==3 | n==7 | n==11 | n==15 , mcolor(black) )	
	(rcap l`m'`p' u`m'`p' n 	if n==2 | n==6 | n==10 | n==14 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  		if n==2 | n==6 | n==10 | n==14 , mcolor(black) msymbol(circle_hollow) )	
	(rcap l`m'`p' u`m'`p'  n 	if n==1 | n==5 | n==9  | n==13 , horizontal lcolor(black)) 
	(scatter n b`m'`p'  		if n==1 | n==5 | n==9  | n==13 , mcolor(black) msymbol(square_hollow) )	
	, 
	xline(0, lcolor(black)) 
	ylabel(
	16  "{bf:P(Dist):}" 
	15	`" "${label1a`p'}{it:`d`m'15`p''}" "'
	14	`" "${label1b`p'}{it:`d`m'14`p''}" "'
	13	`" "{it:`d`m'13`p''}" "'
	12	" "
	11	`" "${label2a`p'}{it:`d`m'11`p''}" "'
	10	`" "${label2b`p'}{it:`d`m'10`p''}" "'
	9	`" "{it:`d`m'9`p''}" "'
	8	" "
	7	`" "${label3a`p'}{it:`d`m'7`p''}" "'
	6	`" "${label3b`p'}{it:`d`m'6`p''}" "'
	5	`" "{it:`d`m'5`p''}" "'
	4	" "
	3	`" "${label4a`p'}{it:`d`m'3`p''}" "'
	2	`" "${label4b`p'}{it:`d`m'2`p''}" "'
	1	`" "{it:`d`m'1`p''}" "'
	, angle(0) labsize(small)) 
	xtitle(" " "{bf:${party`p'}}" "{it:${var`p'}}" " ")
	ytitle("")
	ylab(, nogrid)
	xlab(-0.05(0.025)0.05)
	graphregion(color(white)) 
	legend(order(2 "Base" 4 "Policy Sub-Index" 
	6 "Belief Sub-Index" ) 
	rows(1) size(*0.75) symxsize(*0.4))
	ylabel(, tlength(0))
	saving("$out/`m'`p'.gph", replace)
	;
	# delimit cr
	
}
}

*xsize(${width`p'}) ysize(5) 
# delimit ;
grc1leg "$out/m0.gph" "$out/m1.gph", 
	ycommon xcommon legendfrom("$out/m0.gph")
	graphregion(color(white)) 
	imargin(-5.5 -5.5 -6 -7) scale(1.1) 
	;
# delimit cr
graph export "$out/B12_ByPolicyBelief_AnonymousMessage.pdf", replace	
*	xsize(9) ysize(9)


# delimit ;
grc1leg "$out/ms0.gph" "$out/ms1.gph", 
	ycommon xcommon legendfrom("$out/ms1.gph")
	graphregion(color(white)) 
	imargin(-5.5 -5.5 -6 -7) scale(1.1) 
	;
# delimit cr
graph export "$out/B12_ByPolicyBelief_Persuasion.pdf", replace	
*	xsize(9) ysize(9)





